import java.util.ArrayList;


public class Coordinate {

	public int x;
	public int y;
	
	public Coordinate(int x, int y){
		this.x =x;
		this.y = y;
	}
	
	public String toString(){
		return "(" + x + "," + y + ")";
	}
	
	
	@Override
	public boolean equals(Object o){
		
		return ((((Coordinate)o).x == x) && (((Coordinate)o).y == y));
		
	}
	
	public static void main(String args[]){
		Coordinate co = new Coordinate(1,1);
		Coordinate co1 = new Coordinate(1,1);
		Coordinate co2 = new Coordinate(5,1);
		Coordinate co3 = new Coordinate(5,1);
		Coordinate co4 = new Coordinate(5,5);
		
		ArrayList<Coordinate> list = new ArrayList<Coordinate>();
		list.add(co);
		list.add(co3);
		
		System.out.println(co.toString() + " equals " + co1.toString() +  "-> " + co.equals(co1));
		System.out.println(co.toString() + " equals " + co2.toString() +  "-> " + co.equals(co2));
		System.out.println(co3.toString() + " equals " + co2.toString() +  "-> " + co3.equals(co2));
		
		
		System.out.println("contains: " + co4.toString() + "->" + list.contains(new Coordinate(5,5)));
		System.out.println("contains: " + co.toString() + "->" + list.contains(co));
		System.out.println("contains: " + co3.toString() + "->" + list.contains(co3));
		
	}
	
}
